#ifndef _MY_NPC_3_H_
#define _MY_NPC_3_H_

#include "../enemy.h"
#include "path.h"

namespace fireplane
{
	typedef enum _npc3_state{
		e_npc3_normal,
		e_npc3_standby,
		e_npc3_aim,
		e_npc3_max
	}e_npc3_state;

	class Path;
	class Gun;

	class NPC3 : public Enemy{
	public:
		NPC3(EnemyType type);
		~NPC3();

	public:
		virtual bool updateState(float dt);
		virtual void onInit(CreateArg* arg);
		virtual void destroy();
		virtual void onAttack();
		virtual void onCollision2Player();

		void _onAttack(int addHp);

		bool initBezier(string npc_name ,CCPoint gen_pos);
		void goBeizer(float dt);
		void calcNextPos();
		void calcRoate(CCPoint lastPos);
		float getAngle(CCPoint ref_pos);
		void doNPCstate(float dt);
	private:
		CCSprite* _sprite;
		Gun* _gun;
		bool _is_attak;
		float _attack_back_time;
		float _fire_tick;
		float _fire_middle_gun_tick;
		bool _is_deading;

		e_npc3_state _state;
		CCPoint _dir;

		BezierList* _bezier_list;
		BezierList::iterator _bezier_it;
		int _total_step;
		int _cur_step;
		CCPoint _next_pos;
		float _speed;

		float _total_angle;
		float _cur_angle;
	};
}

#endif